﻿#include <iostream>
#include <memory>

#include"../Log/Log.h"
#include"../Model/OCCTModel.h"
#include"../Visualization/VTKRenderer.h"
#include"../Config/ConfigFileManage.h"
#include"../Cmd/CommandManage.h"
#include"../Cmd/CommandConsole.h"
#include"../Data/DataCenter.h"

/// @brief 程序入口
/// @param argc 程序参数个数
/// @param argv 程序参数数组
/// @return 程序退出状态码
int main(int argc, char* argv[])
{  
    // 初始化日志系统
    Log::Init("cad.log");

    // 加载配置文件
    const char *XmlFilePath[] = { "CadDemo.exe", "../../../../Src/Config/Config.xml" };
    std::vector<CmdParameter> CmdParam = ConfigFileManage::ParseConfigFile(2, const_cast<char **>(XmlFilePath));

    // 启动控制台命令解析循环
    std::unique_ptr<CommandConsole> CmdConsl = std::make_unique<CommandConsole>(VTKRenderer::getInstance());
    CmdConsl->StartCommandLoop();
    
    // 执行命令
    if(!CmdParam.empty()) CommandManage::Command(CmdParam);
    
    return EXIT_SUCCESS;
}